home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 119
/
(Vol 119) Nov 09 2010.iso
/
Games
/
crusade_of_cuisine.swf
/
scripts
/
frame_13
/
DoAction.as
< prev
Wrap
Text File
|
2010-11-09
|
34KB
|
1,256 lines
_root.createEmptyMovieClip("burgerLayer",98);
_root.createEmptyMovieClip("MMLayer",91);
_root.createEmptyMovieClip("kfcLayer",89);
_root.createEmptyMovieClip("bossLayer",88);
_root.createEmptyMovieClip("bulletLayer",99);
_root.createEmptyMovieClip("fireLayer",96);
_root.createEmptyMovieClip("pigLayer",97);
_root.createEmptyMovieClip("bulletLayer",95);
_root.createEmptyMovieClip("swordfishLayer",94);
_root.createEmptyMovieClip("dolphinLayer",103);
_root.createEmptyMovieClip("gatorLayer",105);
if(nellySelected == true)
{
_root.createEmptyMovieClip("player",100);
player.attachMovie("fridge_mov",fridge,90);
player._x = 600;
player._y = 300;
player._xscale = 100;
player._yscale = 100;
}
if(nellySelected == false)
{
_root.createEmptyMovieClip("player2",101);
player2.attachMovie("theFish_mov",fish,102);
player2._x = 600;
player2._y = 300;
player2._xscale = 80;
player2._yscale = 80;
}
var repeatTime = 0;
var repeatTime2 = 0;
var repeatTime3 = 0;
var pigCount = 81;
var pigPresent = false;
var hpRegenDelay = 0;
var repeatTimeP2_ = 0;
var repeatTimeP2_2 = 0;
var repeatTimeP2_3 = 29;
var dolphinCount = 81;
var dolphinPresent = false;
var spRegenDelay2 = 0;
tryAgain_mv._visible = false;
var bulletCount = 0;
var MMCount = 0;
var burgerCount = 0;
var kfcCount = 0;
var enemyBurger = 0;
var enemyMM = 0;
var enemyGator = 0;
var enemyKfc = 0;
var bossEnemy = 0;
var kfcPresent = false;
var bossPresent = false;
var speed = 6;
var chickenDamage = 25;
var chickenDelay = 5;
var pigDelay = 5;
var pigDamage = 75;
var fireDelay = 1;
var fireDamage = 6;
var playerHP = 130;
var playerMaxHP = 130;
var playerSP = 100;
var playerMaxSP = 100;
var playerDisSP = Math.floor(playerSP);
var playerDisHP = Math.floor(playerHP);
var player1Money = 0;
var speed_2 = 12;
var pinkFishBulletDamage = 20;
var pinkFishBulletDelay = 10;
var dolphinDelay = 2;
var dolphinDamage = 80;
var swordfishDelay = 20;
var swordfishDamage = 45;
var player2MaxHP = 95;
var player2HP = 95;
var player2SP = 125;
var player2MaxSP = 125;
var player2DisSP = Math.floor(player2SP);
var player2Regen = player2MaxSP / 100;
var player2Money = 0;
var bulletNumber = 60;
var burgerHP = 60;
var burgerRate = 10;
var burgerNumber = 100;
var statueHP = 4000;
var newbg_dx = 2;
player.onEnterFrame = function()
{
checkKey1();
spawnEnemy();
checkBeingHit();
hpRegen();
updateStat();
platformScroller();
if(playerHP <= 0)
{
player.removeMovieClip();
tryAgain_mv._visible = true;
kfcLayer.removeMovieClip();
bossLayer.removeMovieClip();
}
};
player2.onEnterFrame = function()
{
checkKey2();
spawnEnemy();
checkBeingHit();
spRegen2();
updateStat();
platformScroller();
if(player2HP <= 0)
{
player2.removeMovieClip();
tryAgain_mv._visible = true;
kfcLayer.removeMovieClip();
bossLayer.removeMovieClip();
}
};
checkKey1 = function()
{
if(Key.isDown(69))
{
playerHP++;
playerSP++;
}
if(Key.isDown(37))
{
player._x += - speed;
if(player._x < 50)
{
player._x = 50;
}
}
if(Key.isDown(39))
{
player._x += speed;
if(player._x > 750)
{
player._x = 750;
}
}
if(Key.isDown(38))
{
player._y += - speed;
if(player._y < 50)
{
player._y = 50;
}
}
if(Key.isDown(40))
{
player._y += speed;
if(player._y > 420)
{
player._y = 420;
}
}
if(Key.isDown(67))
{
firing1 = true;
repeatTime++;
repeatTime %= chickenDelay;
}
else
{
firing1 = false;
}
if(firing1 && repeatTime == 0 && firing3 == false)
{
nellyStat.logo_chicken.gotoAndPlay(2);
createChicken("chicken_mov",player._x,player._y,-15,Math.random() * 6 - 3);
}
if(Key.isDown(90))
{
firing2 = true;
repeatTime2++;
repeatTime2 %= pigDelay;
}
else
{
firing2 = false;
}
if(firing2 && repeatTime2 == 1 && playerSP >= 30 && pigPresent == false)
{
pigPresent = true;
nellyStat.logo_pig.gotoAndPlay(2);
playerSP -= 30;
createPig("pig_mov",player._x - 100,player._y + 100,-0.2,0);
}
if(Key.isDown(88))
{
repeatTime3++;
repeatTime3 %= fireDelay;
if(playerSP > 0)
{
firing3 = true;
}
if(playerSP < 0)
{
playerSP = 0;
}
}
else
{
firing3 = false;
}
if(firing3 && repeatTime3 == 0 && firing1 == false && firing2 == false && playerSP > 0)
{
player[fridge].gotoAndPlay("player_fire");
nellyStat.logo_cow.gotoAndPlay(2);
playerSP -= 1;
createFire("fire_mov",player._x - 60,player._y + 70,-10,Math.random() * 12 - 6);
}
else
{
nellyStat.logo_cow.gotoAndPlay(1);
}
};
checkKey2 = function()
{
if(Key.isDown(69))
{
player2HP++;
player2SP++;
}
if(Key.isDown(37))
{
player2._x += - speed_2;
if(player2._x < 50)
{
player2._x = 50;
}
}
if(Key.isDown(39))
{
player2._x += speed_2;
if(player2._x > 750)
{
player2._x = 750;
}
}
if(Key.isDown(38))
{
player2._y += - speed_2;
if(player2._y < 10)
{
player2._y = 10;
}
}
if(Key.isDown(40))
{
player2._y += speed_2;
if(player2._y > 500)
{
player2._y = 500;
}
}
if(Key.isDown(67))
{
firing1 = true;
repeatTimeP2_++;
repeatTimeP2_ %= pinkFishBulletDelay;
}
else
{
firing1 = false;
}
if(firing1 && repeatTimeP2_ == 0 && firing3 == false)
{
linaStat.logo_pinkfish.gotoAndPlay(2);
createpinkFishBullet("pinkFishBullet_mov",player2._x - 50,player2._y + 35,-20 + Math.random() * 3,0);
createpinkFishBullet("pinkFishBullet_mov",player2._x - 60,player2._y + 50,-20 + Math.random() * 3,0);
createpinkFishBullet("pinkFishBullet_mov",player2._x - 50,player2._y + 65,-20 + Math.random() * 3,0);
}
if(Key.isDown(90))
{
firing2 = true;
repeatTimeP2_2++;
repeatTimeP2_2 %= dolphinDelay;
}
else
{
firing2 = false;
}
if(firing2 && repeatTimeP2_2 == 1 && player2SP >= 10 && dolphinPresent == false)
{
dolphinPresent = true;
linaStat.logo_dolphin.gotoAndPlay(2);
player2SP -= 10;
createdolphin("dolphinRing_mov",player2._x,player2._y,0,0);
}
if(Key.isDown(88))
{
repeatTimeP2_3++;
repeatTimeP2_3 %= swordfishDelay;
if(player2SP > 0)
{
firing3 = true;
}
if(player2SP < 0)
{
player2SP = 0;
}
}
else
{
firing3 = false;
repeatTimeP2_3++;
if(repeatTimeP2_3 >= swordfishDelay - 1)
{
repeatTimeP2_3 = swordfishDelay - 1;
}
}
if(firing3 && repeatTimeP2_3 == 0 && firing1 == false && firing2 == false && player2SP >= 20)
{
linaStat.logo_swordfish.gotoAndPlay(2);
player2SP -= 20;
createswordfish("swordfish_mov",player2._x + 100,player2._y + 150,-20,0);
}
};
createChicken = function(type, x, y, dx, dy)
{
bulletCount++;
bulletCount %= bulletNumber;
cnm = "chicken" + bulletCount;
bulletLayer.attachMovie(type,cnm,bulletCount);
bulletLayer[cnm]._x = x;
bulletLayer[cnm]._y = y;
bulletLayer[cnm].dx = dx;
bulletLayer[cnm].dy = dy;
bulletLayer[cnm]._xscale = 90;
bulletLayer[cnm]._yscale = 90;
bulletLayer[cnm].onEnterFrame = function()
{
this._x += this.dx;
this._y += this.dy;
if(this._x < player._x - 700)
{
this.removeMovieClip();
}
var _loc2_ = 0;
while(_loc2_ < burgerNumber)
{
var _loc3_ = "burger" + _loc2_;
if(this.hitTest(burgerLayer[_loc3_]) && burgerLayer[_loc3_]._currentframe < 16 && this._currentframe < 21)
{
burgerLayer[_loc3_].hp -= chickenDamage;
playerSP += 0.35;
this.dx = 0;
this.gotoAndPlay("bullet_die");
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
var _loc4_ = "hitSpot" + _loc2_;
if(this.hitTest(statue_mov[_loc4_]) && this._currentframe < 21)
{
statueHP -= chickenDamage;
playerSP += 0.2;
this.dx = 0;
this.gotoAndPlay("bullet_die");
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
_loc3_ = "kfc" + _loc2_;
if(this.hitTest(kfcLayer[_loc3_]) && kfcLayer[_loc3_]._currentframe <= 10 && this._currentframe < 21)
{
kfcLayer[_loc3_].hp -= chickenDamage;
playerSP += 0.2;
this.gotoAndPlay("bullet_die");
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
_loc3_ = "boss" + _loc2_;
if(this.hitTest(bossLayer[_loc3_].boss_eye) && this._currentframe < 21)
{
bossLayer[_loc3_].hp -= chickenDamage;
playerSP += 1;
this.gotoAndPlay("bullet_die");
}
_loc2_ = _loc2_ + 1;
}
};
};
createpinkFishBullet = function(type, x, y, dx, dy)
{
bulletCount++;
bulletCount %= bulletNumber;
cnm = "pinkFishBullet" + bulletCount;
bulletLayer.attachMovie(type,cnm,bulletCount);
bulletLayer[cnm]._x = x;
bulletLayer[cnm]._y = y;
bulletLayer[cnm].dx = dx;
bulletLayer[cnm].dy = dy;
bulletLayer[cnm]._xscale = 25;
bulletLayer[cnm]._yscale = 25;
bulletLayer[cnm].onEnterFrame = function()
{
this._x += this.dx;
this._y += this.dy;
if(this.hitTest(testObject) && this._currentframe < 21)
{
testHP += pinkFishBulletDamage;
this.dx = 0;
this.gotoAndPlay("bullet_die");
}
if(this._x < player2._x - 700)
{
this.removeMovieClip();
}
var _loc2_ = 0;
while(_loc2_ < burgerNumber)
{
var _loc3_ = "burger" + _loc2_;
if(this.hitTest(burgerLayer[_loc3_]) && burgerLayer[_loc3_]._currentframe < 16 && this._currentframe < 21)
{
burgerLayer[_loc3_].hp -= pinkFishBulletDamage;
this.dx = 0;
this.gotoAndPlay("bullet_die");
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
var _loc4_ = "hitSpot" + _loc2_;
if(this.hitTest(statue_mov[_loc4_]) && this._currentframe < 21)
{
statueHP -= pinkFishBulletDamage;
this.dx = 0;
this.gotoAndPlay("bullet_die");
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
_loc3_ = "kfc" + _loc2_;
if(this.hitTest(kfcLayer[_loc3_]) && kfcLayer[_loc3_]._currentframe <= 10 && this._currentframe < 21)
{
kfcLayer[_loc3_].hp -= pinkFishBulletDamage;
this.gotoAndPlay("bullet_die");
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
_loc3_ = "boss" + _loc2_;
if(this.hitTest(bossLayer[_loc3_].boss_eye) && this._currentframe < 21)
{
bossLayer[_loc3_].hp -= pinkFishBulletDamage;
this.gotoAndPlay("bullet_die");
}
_loc2_ = _loc2_ + 1;
}
};
};
createPig = function(type, x, y, dx, dy)
{
pigCount++;
if(pigCount > 81)
{
pigCount = 81;
}
pnm = "pig" + pigCount;
pigLayer.attachMovie(type,pnm,pigCount);
pigLayer[pnm]._x = x;
pigLayer[pnm]._y = y;
pigLayer[pnm].dx = dx;
pigLayer[pnm].dy = dy;
pigLayer[pnm]._xscale = 100;
pigLayer[pnm]._yscale = 100;
pigLayer[pnm].pTimer = 0;
pigLayer[pnm].pHP = 40;
pigLayer[pnm].onEnterFrame = function()
{
this.pTimer = this.pTimer + 1;
this.pTimer %= 240;
this._x += this.dx;
this._y += this.dy;
if((this.pTimer > 220 || this.pHP <= 0) && this._currentframe < 16)
{
nellyStat.logo_pig.gotoAndPlay(1);
pigPresent = false;
this.gotoAndPlay("pig_die");
}
var _loc2_ = 0;
while(_loc2_ < burgerNumber)
{
var _loc3_ = "burger" + _loc2_;
if(this.hitTest(burgerLayer[_loc3_]) && burgerLayer[_loc3_]._currentframe < 16)
{
burgerLayer[_loc3_].hp -= pigDamage;
this.pHP = this.pHP - 1;
if(this._currentframe < 16)
{
this.gotoAndPlay("pig_hit");
}
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
var _loc4_ = "hitSpot" + _loc2_;
if(this.hitTest(statue_mov[_loc4_]) && this._currentframe < 16)
{
this.pHP = this.pHP - 1;
this.gotoAndPlay("pig_hit");
statueHP -= pigDamage;
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
_loc3_ = "gator" + _loc2_;
if(this.hitTest(gatorLayer[_loc3_]) && this._currentframe < 16 && gatorLayer[_loc3_]._currentframe <= 15)
{
this.pHP = this.pHP - 1;
this.gotoAndPlay("pig_hit");
gatorLayer[_loc3_].gotoAndPlay("gator_die");
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
_loc3_ = "kfc" + _loc2_;
if(this.hitTest(kfcLayer[_loc3_]) && this._currentframe < 16)
{
this.pHP = this.pHP - 1;
this.gotoAndPlay("pig_hit");
kfcLayer[_loc3_].hp -= pigDamage;
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
_loc3_ = "boss" + _loc2_;
if(this.hitTest(bossLayer[_loc3_].boss_eye) && this._currentframe < 16)
{
this.pHP = this.pHP - 1;
this.gotoAndPlay("pig_hit");
bossLayer[_loc3_].hp -= pigDamage;
}
_loc2_ = _loc2_ + 1;
}
};
};
createdolphin = function(type, x, y, dx, dy)
{
dolphinCount++;
if(dolphinCount > 81)
{
dolphinCount = 81;
}
pnm = "dolphin" + dolphinCount;
dolphinLayer.attachMovie(type,pnm,dolphinCount);
dolphinLayer[pnm]._x = x;
dolphinLayer[pnm]._y = y;
dolphinLayer[pnm].dx = dx;
dolphinLayer[pnm].dy = dy;
dolphinLayer[pnm]._xscale = 100;
dolphinLayer[pnm]._yscale = 100;
dolphinLayer[pnm].pTimer = 0;
dolphinLayer[pnm].pHP = 30;
dolphinLayer[pnm].onEnterFrame = function()
{
this.pTimer = this.pTimer + 1;
this.pTimer %= 360;
this._x = player2._x;
this._y = player2._y;
if((this.pTimer > 350 || this.pHP <= 0 || player2SP <= 0) && this._currentframe <= 7)
{
linaStat.logo_dolphin.gotoAndPlay(1);
dolphinPresent = false;
this.gotoAndPlay("dolphin_die");
}
var _loc2_ = 0;
while(_loc2_ < burgerNumber)
{
var _loc3_ = "burger" + _loc2_;
if(this.hitTest(burgerLayer[_loc3_]) && burgerLayer[_loc3_]._currentframe <= 7)
{
burgerLayer[_loc3_].hp -= dolphinDamage;
this.pHP = this.pHP - 1;
player2SP -= 5 * difficulty;
this.gotoAndPlay("dolphin_hit");
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
var _loc4_ = "hitSpot" + _loc2_;
if(this.hitTest(statue_mov[_loc4_]) && this._currentframe < 7)
{
this.pHP = this.pHP - 1;
player2SP -= 5 * difficulty;
this.gotoAndPlay("dolphin_hit");
statueHP -= dolphinDamage;
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
_loc3_ = "gator" + _loc2_;
if(this.hitTest(gatorLayer[_loc3_]) && this._currentframe < 7 && gatorLayer[_loc3_]._currentframe <= 15)
{
this.pHP = this.pHP - 1;
player2SP -= 10 * difficulty;
this.gotoAndPlay("dolphin_hit");
gatorLayer[_loc3_].gotoAndPlay("gator_die");
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
_loc3_ = "kfc" + _loc2_;
if(this.hitTest(kfcLayer[_loc3_]) && this._currentframe < 7)
{
this.pHP = this.pHP - 1;
player2SP -= 5 * difficulty;
this.gotoAndPlay("dolphin_hit");
kfcLayer[_loc3_].hp -= dolphinDamage;
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
_loc3_ = "boss" + _loc2_;
if(this.hitTest(bossLayer[_loc3_].boss_eye) && this._currentframe < 7)
{
this.pHP = this.pHP - 1;
player2SP -= 5 * difficulty;
this.gotoAndPlay("dolphin_hit");
bossLayer[_loc3_].hp -= dolphinDamage;
}
_loc2_ = _loc2_ + 1;
}
};
};
createFire = function(type, x, y, dx, dy)
{
bulletCount++;
bulletCount %= 15;
fnm = "fire" + bulletCount;
fireLayer.attachMovie(type,fnm,bulletCount);
fireLayer[fnm]._x = x;
fireLayer[fnm]._y = y;
fireLayer[fnm].dx = dx;
fireLayer[fnm].dy = dy;
fireLayer[fnm]._xscale = 100;
fireLayer[fnm]._yscale = 100;
fireLayer[fnm].onEnterFrame = function()
{
this._x += this.dx;
this._y += this.dy;
if(this._x < player._x - 250)
{
this.removeMovieClip();
}
if(this.hitTest(testObject))
{
testHP += fireDamage;
}
var _loc2_ = 0;
while(_loc2_ < burgerNumber)
{
var _loc3_ = "burger" + _loc2_;
if(this.hitTest(burgerLayer[_loc3_]) && burgerLayer[_loc3_]._currentframe < 16)
{
burgerLayer[_loc3_].hp -= fireDamage;
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
var _loc4_ = "hitSpot" + _loc2_;
if(this.hitTest(statue_mov[_loc4_]))
{
statueHP -= fireDamage;
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
_loc3_ = "kfc" + _loc2_;
if(this.hitTest(kfcLayer[_loc3_]) && kfcLayer[_loc3_]._currentframe <= 10)
{
kfcLayer[_loc3_].hp -= fireDamage;
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
_loc3_ = "boss" + _loc2_;
if(this.hitTest(bossLayer[_loc3_].boss_eye))
{
bossLayer[_loc3_].hp -= fireDamage;
}
_loc2_ = _loc2_ + 1;
}
};
};
createswordfish = function(type, x, y, dx, dy)
{
bulletCount++;
bulletCount %= bulletNumber;
fnm = "swordfish" + bulletCount;
swordfishLayer.attachMovie(type,fnm,bulletCount);
swordfishLayer[fnm]._x = x;
swordfishLayer[fnm]._y = y;
swordfishLayer[fnm].dx = dx;
swordfishLayer[fnm].dy = dy;
swordfishLayer[fnm]._xscale = 100;
swordfishLayer[fnm]._yscale = 100;
swordfishLayer[fnm].onEnterFrame = function()
{
this._x += this.dx;
this._y += this.dy;
if(this._x < -75)
{
this.removeMovieClip();
}
if(this.hitTest(testObject))
{
testHP += swordfishDamage;
}
var _loc2_ = 0;
while(_loc2_ < burgerNumber)
{
var _loc3_ = "burger" + _loc2_;
if(this.hitTest(burgerLayer[_loc3_]) && burgerLayer[_loc3_]._currentframe < 16)
{
burgerLayer[_loc3_].hp -= swordfishDamage;
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
var _loc4_ = "hitSpot" + _loc2_;
if(this.hitTest(statue_mov[_loc4_]))
{
statueHP -= swordfishDamage;
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
_loc3_ = "kfc" + _loc2_;
if(this.hitTest(kfcLayer[_loc3_]) && kfcLayer[_loc3_]._currentframe <= 10)
{
kfcLayer[_loc3_].hp -= swordfishDamage;
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
_loc3_ = "boss" + _loc2_;
if(this.hitTest(bossLayer[_loc3_].boss_eye))
{
bossLayer[_loc3_].hp -= swordfishDamage;
}
_loc2_ = _loc2_ + 1;
}
};
};
spawnEnemy = function()
{
enemyBurger++;
enemyBurger %= burgerRate;
if(enemyBurger == 0)
{
if(nellySelected == true)
{
burgerY = player._y;
}
if(nellySelected == false)
{
burgerY = player2._y;
}
createBurger("burger",-10,burgerY);
createBurger("burger",0,burgerY);
createBurger("burger",20,burgerY);
}
};
createBurger = function(type, x, y)
{
burgerCount++;
burgerCount %= burgerNumber;
nm = "burger" + burgerCount;
burgerLayer.attachMovie(type,nm,burgerCount);
burgerLayer[nm]._y = y;
burgerLayer[nm].yline = y;
burgerLayer[nm]._x = x;
burgerLayer[nm].dx = Math.random() * 3 + 10;
burgerLayer[nm].t = Math.random() * 6.28;
burgerLayer[nm]._xscale = -75;
burgerLayer[nm]._yscale = 75;
burgerLayer[nm].hp = burgerHP;
burgerLayer[nm].onEnterFrame = function()
{
this._y = this.yline + Math.sin(this.t) * 100;
this._x += this.dx;
this.t += 0.1;
if(this._y > 800)
{
this.removeMovieClip();
}
if(this._y < -200)
{
this.removeMovieClip();
}
if(this._x > 800)
{
this.removeMovieClip();
}
if(this._x < 0)
{
this.removeMovieClip();
}
if(this.hp <= 0 && this._currentframe < 16)
{
this.gotoAndPlay("enemy_die");
player1Money += 2;
player2Money += 2;
}
};
};
createMM = function(x, y)
{
MMCount++;
MMCount %= 20;
mnm = "MM" + MMCount;
MMLayer.attachMovie("MM_mov",mnm,20 - MMCount);
MMLayer[mnm]._x = x;
MMLayer[mnm]._y = y;
MMLayer[mnm].scaleAcc = 0.5;
MMLayer[mnm].scaleRate = 0.5;
MMLayer[mnm]._xscale = 10;
MMLayer[mnm]._yscale = 10;
MMLayer[mnm].frame = Math.ceil(Math.random() * 4);
MMLayer[mnm].yrange = (- Math.random()) * 14;
MMLayer[mnm].xrange = Math.random() * 8 - 4;
MMLayer[mnm].onEnterFrame = function()
{
this.scaleRate += 0.1;
this._xscale += this.scaleRate;
this._yscale += this.scaleRate;
this._x += this.xrange;
this._y += this.yrange;
if(this._xscale >= 130 && this._currentframe < 5)
{
this.gotoAndPlay("enemy_die");
}
};
};
gatorCount = 0;
createGator = function(x, y, z)
{
gatorCount++;
gatorCount %= 20;
gnm = "gator" + gatorCount;
gatorLayer.attachMovie("gator_mov",gnm,gatorCount);
gatorLayer[gnm]._x = x;
gatorLayer[gnm]._y = y;
gatorLayer[gnm].dy = z;
gatorLayer[gnm].dyAcc = 1;
gatorLayer[gnm].onEnterFrame = function()
{
this._x -= 1;
this.dy += this.dyAcc;
this._y += this.dy;
if(this.dy >= 0 && this._currentframe < 5)
{
if(this._currentframe < 16)
{
this.gotoAndPlay("gator_turn");
}
}
if(this._y > 600)
{
this.removeMovieClip();
}
};
};
createKfc = function(x, y)
{
kfcCount++;
kfcCount %= 20;
knm = "kfc" + kfcCount;
kfcLayer.attachMovie("kfc_mov",knm,kfcCount);
kfcLayer[knm]._x = x;
kfcLayer[knm]._y = y;
kfcLayer[knm].hp = 2000;
kfcLayer[knm].speed = 2;
kfcLayer[knm].onEnterFrame = function()
{
if(nellySelected == true)
{
if(this._x > player._x)
{
this._x -= this.speed;
}
if(this._x < player._x)
{
this._x += this.speed;
}
}
if(nellySelected == false)
{
if(this._x > player2._x)
{
this._x -= this.speed;
}
if(this._x < player2._x)
{
this._x += this.speed;
}
}
enemyGator++;
enemyGator %= 40;
if(enemyGator == 0)
{
createGator(this._x + 50,600,-25);
}
if(this.hp <= 0 && this._currentframe <= 10)
{
this.gotoAndPlay("enemy_die");
player1Money += 200;
player2Money += 200;
}
};
};
bossCount = 0;
bossTimer = 0;
createBoss = function(x, y)
{
bossCount = 1;
bnm = "boss" + bossCount;
bossLayer.attachMovie("boss_1_mov",bnm,bossCount);
bossLayer[bnm]._x = x;
bossLayer[bnm]._y = y;
bossLayer[bnm].MaxHp = 4000;
bossLayer[bnm].hp = 4000;
bossLayer[bnm].randomAtk = 0;
bossLayer[bnm].atk1 = false;
bossLayer[bnm].atk2 = false;
bossLayer[bnm].atk3 = false;
bossLayer[bnm].onEnterFrame = function()
{
this.hpBar._width = this.hp / this.MaxHp * 600;
burgerRate = 9999999999;
bossTimer++;
bossTimer %= 100;
enemyGator++;
enemyGator %= 20;
if(enemyGator == 0 && this._currentframe < 111 && this._currentframe > 80)
{
createGator(Math.random() * 500 + 100,600,-33);
}
if(bossTimer == 0 && this._currentframe < 206)
{
this.randomAtk = Math.random() * 100;
if(this.randomAtk <= 33)
{
this.gotoAndPlay("enemy_atk1");
}
if(this.randomAtk > 33 && this.randomAtk <= 66)
{
this.gotoAndPlay("enemy_atk2");
}
if(this.randomAtk > 66)
{
this.gotoAndPlay("enemy_atk3_begin");
}
}
if(this.hp <= 0 && this._currentframe < 206)
{
this.gotoAndPlay("enemy_die");
player1Money += 500;
player2Money += 500;
bossLayer.attachMovie("next_stage_mov","next_stage",10);
bossLayer.next_stage._x = 400;
bossLayer.next_stage._y = 300;
bossLayer.next_stage.next_btn.onRelease = function()
{
_root.gotoAndPlay("story_2");
bossLayer.next_stage.removeMovieClip();
player.removeMovieClip();
player2.removeMovieClip();
};
}
};
};
checkBeingHit = function()
{
var _loc2_ = 0;
while(_loc2_ < burgerNumber)
{
var _loc3_ = "burger" + _loc2_;
if(player[fridge].main.hitTest(burgerLayer[_loc3_]) && burgerLayer[_loc3_]._currentframe < 16)
{
burgerLayer[_loc3_].gotoAndPlay("enemy_die");
player[fridge].gotoAndPlay("player_hit");
playerHP -= 12 * difficulty;
}
if(player2[fish].main.hitTest(burgerLayer[_loc3_]) && burgerLayer[_loc3_]._currentframe < 16)
{
burgerLayer[_loc3_].gotoAndPlay("enemy_die");
player2[fish].gotoAndPlay("player_hit");
player2HP -= 12 * difficulty;
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
_loc3_ = "MM" + _loc2_;
if(player[fridge].main.hitTest(MMLayer[_loc3_]) && MMLayer[_loc3_]._currentframe < 5 && MMLayer[_loc3_]._xscale > 90)
{
MMLayer[_loc3_].gotoAndPlay("enemy_die");
player[fridge].gotoAndPlay("player_hit");
playerHP -= 20 * difficulty;
}
if(player2[fish].main.hitTest(MMLayer[_loc3_]) && MMLayer[_loc3_]._currentframe < 5 && MMLayer[_loc3_]._xscale > 90)
{
MMLayer[_loc3_].gotoAndPlay("enemy_die");
player2[fish].gotoAndPlay("player_hit");
player2HP -= 20 * difficulty;
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
_loc3_ = "gator" + _loc2_;
if(player[fridge].main.hitTest(gatorLayer[_loc3_]) && gatorLayer[_loc3_]._currentframe <= 15)
{
player[fridge].gotoAndPlay("player_hit");
playerHP -= 10 * difficulty;
gatorLayer[_loc3_].gotoAndPlay("gator_die");
}
if(player2[fish].main.hitTest(gatorLayer[_loc3_]) && gatorLayer[_loc3_]._currentframe <= 15)
{
player2[fish].gotoAndPlay("player_hit");
player2HP -= 10 * difficulty;
gatorLayer[_loc3_].gotoAndPlay("gator_die");
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
_loc3_ = "kfc" + _loc2_;
if(player[fridge].main.hitTest(kfcLayer[_loc3_]) && (player[fridge]._currentframe <= 30 || player[fridge]._currentframe > 37))
{
player[fridge].gotoAndPlay("player_hit");
playerHP -= 4 * difficulty;
}
if(player2[fish].main.hitTest(kfcLayer[_loc3_]) && player2[fish]._currentframe <= 30)
{
player2[fish].gotoAndPlay("player_hit");
player2HP -= 4 * difficulty;
}
_loc2_ = _loc2_ + 1;
}
_loc2_ = 0;
while(_loc2_ < 20)
{
var _loc1_ = "hitSpot" + _loc2_;
if((player[fridge].main.hitTest(bossLayer.boss1.hitSpot1) || player[fridge].main.hitTest(bossLayer.boss1.hitSpot2) || player[fridge].main.hitTest(bossLayer.boss1.boss_spear2[_loc1_]) || player[fridge].main.hitTest(bossLayer.boss1.boss_spear[_loc1_])) && (player[fridge]._currentframe <= 30 || player[fridge]._currentframe > 37))
{
player[fridge].gotoAndPlay("player_hit");
playerHP -= 7 * difficulty;
}
if((player2[fish].main.hitTest(bossLayer.boss1.hitSpot1) || player2[fish].main.hitTest(bossLayer.boss1.hitSpot2) || player2[fish].main.hitTest(bossLayer.boss1.boss_spear2[_loc1_]) || player2[fish].main.hitTest(bossLayer.boss1.boss_spear[_loc1_])) && player2[fish]._currentframe <= 30)
{
player2[fish].gotoAndPlay("player_hit");
player2HP -= 7 * difficulty;
}
_loc2_ = _loc2_ + 1;
}
};
hpRegen = function()
{
hpRegenDelay++;
hpRegenDelay %= 24;
if(hpRegenDelay == 0)
{
playerHP += playerMaxHP / 100;
}
if(playerHP >= playerMaxHP)
{
playerHP = playerMaxHP;
}
if(playerSP >= playerMaxSP)
{
playerSP = playerMaxSP;
}
};
spRegen2 = function()
{
spRegenDelay2++;
spRegenDelay2 %= 12;
if(spRegenDelay2 == 0)
{
player2SP += player2Regen;
}
if(player2SP > player2MaxSP)
{
player2SP = player2MaxSP;
}
if(player2HP > player2MaxHP)
{
player2HP = player2MaxHP;
}
};
statue_mov._x = -3200;
platform._x = -3200;
skyline._x = -3200;
island1._x = -2200;
island2._x = -1000;
island3._x = -500;
bg_dx = 10;
platformScroller = function()
{
island1._x += bg_dx;
island2._x += bg_dx;
island3._x += bg_dx;
if(platform._x > -1400)
{
enemyKfc++;
enemyKfc %= 30;
if(enemyKfc == 0 && kfcPresent == false)
{
createKfc(50,50);
kfcPresent = true;
burgerRate = 400;
}
}
if(kfcPresent == true)
{
bg_dx = 0;
}
if(kfcLayer[knm].hp <= 0)
{
burgerRate = 40;
bg_dx = newbg_dx;
}
if(island2._x > 100 && island2._x < 700)
{
enemyMM++;
enemyMM %= 30;
if(enemyMM == 0)
{
createMM(island2._x + (Math.random() * 50 - 25),island2._y);
}
}
if(island3._x > 100 && island3._x < 700)
{
enemyMM++;
enemyMM %= 30;
if(enemyMM == 0)
{
createMM(island3._x + (Math.random() * 50 - 25),island3._y);
}
}
if(island1._x > 100 && island1._x < 700)
{
enemyMM++;
enemyMM %= 30;
if(enemyMM == 0)
{
createMM(island1._x + (Math.random() * 50 - 100),island1._y);
}
}
platform._x += bg_dx;
if(platform._x >= 0)
{
platform._x = 0;
}
skyline._x += bg_dx;
if(skyline._x >= 0)
{
skyline._x = 0;
}
statue_mov._x += bg_dx;
statue_mov.hpBar._width = statueHP / 40;
if(statue_mov._x > 0)
{
statue_mov._x = 0;
if(statueHP > 0)
{
burgerRate = 20;
}
if(statueHP <= 0)
{
if(statue_mov._currentframe < 10)
{
statue_mov.gotoAndPlay("statue_die");
}
if(bossPresent == false)
{
bossPresent = true;
createBoss(80,370);
}
burgerRate = 9999999;
}
}
};
updateStat = function()
{
nellyStat.hpBar_p1._width = 115 * (playerHP / playerMaxHP);
nellyStat.spBar_p1._width = 105 * (playerSP / playerMaxSP);
nellyStat.playerDisSP = Math.floor(playerSP);
nellyStat.playerHP = playerHP;
nellyStat.playerDisHP = Math.floor(playerHP);
nellyStat.player1Money = player1Money;
if(nellySelected == true)
{
linaStat._visible = false;
}
linaStat.hpBar_p2._width = 115 * (player2HP / player2MaxHP);
linaStat.spBar_p2._width = 105 * (player2SP / player2MaxSP);
linaStat.player2DisSP = Math.floor(player2SP);
linaStat.player2HP = player2HP;
linaStat.player2Money = player2Money;
if(nellySelected == false)
{
nellyStat._visible = false;
}
};